#include <iostream>

using namespace std;
using ll=long long;
const int N=5*1e6+10;

ll a[N];
ll d[N];
int main()
{
	int n,p;
	cin>>n>>p;
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++)
	{
		d[i]=a[i]-a[i-1];
	}
	while(p--)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		d[x]+=z;
		d[y+1]-=z;
	}
	ll ret=200;
	for(int i=1;i<=n;i++)
	{
		d[i]=d[i-1]+d[i];
		ret=min(ret,d[i]);
	}
	cout<<ret<<endl;
	return 0;
}
